/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package busy.tomcat;

import java.io.File;
import javax.servlet.ServletException;
import org.apache.catalina.Context;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.startup.Tomcat;

/**
 *
 * @author martin
 */
public class BrainTomcat {

  
  
  public static void main(String[] args)
  throws LifecycleException, InterruptedException, ServletException {
    Tomcat tomcat = new Tomcat();
    tomcat.setPort(8088);

    Context ctx = tomcat.addContext("/", new File(".").getAbsolutePath());

    Tomcat.addServlet(ctx, "hello", new testServlet());
    ctx.addServletMapping("/", "hello");

    tomcat.start();
    tomcat.getServer().await();
  }
}
